--
-- Created by IntelliJ IDEA.
-- User: juntao.zhang
-- Date: 2018/5/25
-- Time: 下午1:39
-- To change this template use File | Settings | File Templates.
--

-- Meta class
User = {age = nil, name = "", addr = ""}

-- 派生类的方法 new
function User:new (o,age,name,addr)
    o = o or {}
    setmetatable(o, self)   --将自身的表映射到新new出来的表中
    self.__index = self
    self.age = age or 0
    self.name = name or ""
    self.addr = addr or "";
    return o
end

-- 派生类的方法 printArea
function User:toString ()
    return string.format("age =  %s  name= %s  addr = %s",self.age,self.name, self.addr)
end


return User